<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
	"http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Test loader</title>
		<script language="JavaScript" src="../lib/prototype/prototype.js" type="text/javascript"></script>
		<script language="JavaScript" src="../lib/scriptaculous/effects.js" type="text/javascript"></script>
		<script language="JavaScript" src="../lib/oui/Oui.js" type="text/javascript"></script>
		<link href="../css/testLoader.css" media="screen" type="text/css" rel="stylesheet"/>
	</head>
	<body id="thebody">
			<div id="ouitTestLoaderContainer">
				<h4>Test loader.</h4>
                <div id="ouiProgress">
                <span class="label">Progress:</span>
				<div id="ouiProgressBarContainer"><div id="progressBar" class="progressBarSuccess"></div></div>
                <span class="label">Passed: </span><span id="passedTests" class="label">0</span>
                <span class="label">Failed: </span><span id="failedTests" class="label">0</span>
                <br/>
                    <label>
                        <input type="button" value="Run" onclick="oui.run()"/>
                    </label>
                </div>

                <span class="label">Test suites:</span>
				<div id="ouiTestSuites"></div>
                <span class="label">Stack trace:</span>
				<div id="ouiTestTrace"></div>
			</div>
	</body>
    <script type="text/javascript" language="JavaScript">


    </script>
    <script language="JScript" runat="server">
    function loadSuites(){
       var suite = (Request.QueryString("suite")+"");
       var suitesToLoad = "";
       var fso, f, fc;
       fso = new ActiveXObject("Scripting.FileSystemObject");
       f = fso.GetFolder(Server.MapPath("../suites") + "/" + suite);
       fc = new Enumerator(f.files);
       for (; !fc.atEnd(); fc.moveNext())
       {
          Response.Write("<scr"+"ipt language=\"JavaScript\" src=\"../suites/"+ suite + "/" + fc.item().Name + "\" type=\"text/javascript\"></scr" + "ipt>");
          suitesToLoad += fc.item().Name.replace(".js","") + ",";
       }
       Response.Write("<scr"+"ipt language=\"JavaScript\">\n");
        Response.Write("var oui = new Oui();\n");
       var suitesToLoadArr = suitesToLoad.split(",");
        for(var i=0; i < suitesToLoadArr.length; i++){
            if(suitesToLoadArr[i] != ""){
                Response.Write("oui.addTestSuite('" + suitesToLoadArr[i] + "');\n");
            }
        }
        Response.Write("oui.showSuites();\n");
       Response.Write("</scr"+"ipt>\n");
    }
    </script>
    <%=loadSuites()%>
</html>
